/**
 * capacityconstraint.cpp is part of %PROJECTNAME%.
 *
 * %PROJECTNAME% is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * %PROJECTNAME% is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with %PROJECTNAME%.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "resourcecapacityconstraint.h"
#include "../../utils/visitor/visitor.h"
#include <sstream>

const std::string ResourceCapacityConstraint::RESOURCE_CAPACITY_CONSTRAINT = "Capacity";
const tCapacity ResourceCapacityConstraint::DEFAULT_CAPACITY = 1;

ResourceCapacityConstraint::ResourceCapacityConstraint( tCapacity a_capacity ) :
    ResourceConstraint(),
    m_capacity( a_capacity )
{
}

ResourceCapacityConstraint::~ResourceCapacityConstraint()
{
    m_capacity = DEFAULT_CAPACITY;
}

void ResourceCapacityConstraint::Accept( Visitor * a_visitor )
{
    if( a_visitor )
        a_visitor->Visit( this );
}

std::string ResourceCapacityConstraint::Print() const
{
    std::ostringstream strStream;
    strStream << RESOURCE_CAPACITY_CONSTRAINT << " = " << m_capacity;

    return strStream.str();
}

void ResourceCapacityConstraint::Capacity( tCapacity a_capacity )
{
    m_capacity = a_capacity;
}

tCapacity ResourceCapacityConstraint::Capacity() const
{
    return m_capacity;
}
